package com.neuedu.utils;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;

public class UrlEncoder {
    public static void main(String[] args) throws UnsupportedEncodingException {
        String encode = URLEncoder.encode("张三&pass/word=123", "utf-8");
        System.out.println(encode);
        //zhangsan&password=123
        //zhangsan%26password%3D123

        //URLDecoder.decode(前端过来的数据, "UTF-8")
        String decode = URLDecoder.decode("%E5%BC%A0%E4%B8%89%26pass%2Fword%3D123", "UTF-8");
        System.out.println(decode);
    }
}
